/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Ex;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

/**
 *
 * @author LamHuynh
 */
public class SaxProcessing extends DefaultHandler {
    int count = 0;

    //@Override
    public void characters(char[] ch, int start, int length)
            throws SAXException{
        String s = new String(ch, start, length);
        System.out.println("character: " + s);
    }

    @Override
    public void startDocument() throws SAXException {
        System.out.println("Start Document: >>");
    }

    @Override
    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
        System.out.println("Start Element " + qName);
        if (qName.equals("user")) {
            count++;
        }
    }

    @Override
    public void endDocument() throws SAXException {
        System.out.println("End Document: >>");
    }

    @Override
    public void endElement(String uri, String localName, String qName) throws SAXException {
        System.out.println("End Element " + qName);
    }


}
